﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ReceiveScreen : MonoBehaviour
{
	RawImage rawImage;

	ChatPanel chatPanel;
	void Start() {
		rawImage = GetComponent<RawImage>();
		chatPanel = GameRoot.Instance.uiMng.GetPanel(UIPanelType.ChatPanel) as ChatPanel;
		chatPanel.transform.localScale = Vector3.zero;

		transform.localScale = Vector3.zero;
	}

	void Update() {
		transform.SetAsLastSibling();
	}


	public void OnClickThis() {
		Vector3 scale = transform.localScale;
		if (scale == Vector3.one)
			transform.localScale = Vector3.one * 2;
		else
			transform.localScale = Vector3.one;
	}

	public void OnClickChatButton() {
		GameRoot.Instance.uiMng.PushStack(UIPanelType.ChatPanel);
		transform.Find("Tag").localScale = Vector3.zero;
		while (chatPanel.queues.Count > 0) {
			chatPanel.ShowChat(chatPanel.queues.Dequeue());
		}
	}


	public void OnOpen() {
		transform.localScale = Vector3.one;
	}

}
